import { Component, Input, Output, EventEmitter } from '@angular/core';  

@Component({
    selector : "Carousel",
    templateUrl : "./carousel.component.html",
    styleUrls : ['./carousel.component.css']
})
export class CarouselComponent {
    @Input() config:any;
    @Input() width:string;
    @Input() height:string;
    @Input() isSwitch:string;
    @Input() sum: number;
    @Output() change = new EventEmitter();

    CONFIG:any = {} 
    active:number = 0;
    
    constructor() {}

    ngOnInit() {
        if ( !this.config ) {
            this.CONFIG = {
                width : this.width,
                height : this.height,
                isSwitch : this.isSwitch
            }
        } else {
            this.CONFIG = this.config;
        }
    }
    
    range(sum:number) {
        return new Array(sum);
    }

    activeChange($event) {
        this.active = $event;
        this.change.emit($event);
    }

}